package Reflection;

import java.lang.reflect.Constructor;

public class demo3 {
    public static void main(String[] args) {
        //第一步先获取Class对象
        Class c = Cat.class;

        //第二步再来获取全部构造器(即使用private修饰的构造器也可以获取到)
        Constructor[] constructors = c.getDeclaredConstructors();
        for (Constructor constructor : constructors) {
            System.out.println(constructor.getName() + " =>参数有 " + constructor.getParameterCount() + " 个");
        }

    }

}
